#ifndef GLCANVAS_H
#define GLCANVAS_H

#include "wx/wx.h"
//#include "Interface.h"
#include <wx/glcanvas.h>
#include <GL/glu.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <vector>
#include "liblut/core/LutBound.h"
#include "DonneesAscii.h"

extern "C"
{
#include "trackball.h"
}

struct GLData
{
bool initialized;           // have OpenGL been initialized?
float beginx, beginy;       // position of mouse
float quat[4];              // orientation of object
float zoom;                 // field of view in degrees
};

class glCanvas : public wxGLCanvas
{
    friend class MyFrameVisuOGL;
public:
    glCanvas(wxString nomfichier,
                int attr,
                eLutColorSpace syst,
                int type,
                std::vector<LutBound*> vect,
                wxWindow *parent, wxWindowID id = wxID_ANY,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize,
                long style = 0, const wxString& name = _T("TestGLCanvas") );
    glCanvas(wxWindow *parent, wxWindowID id = wxID_ANY,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize,
                long style = 0, const wxString& name = _T("TestGLCanvas") );
    ~glCanvas();

protected:
    void OnPaint(wxPaintEvent& event);
    void OnChar(wxKeyEvent& event);
    void OnMouse(wxMouseEvent& event);
    void Redimensionnement();
    void OnSize(wxSizeEvent& event);
    void ImportAscii(wxString loadfilename);
    std::vector<DonneesAscii*> lecture_ascii;
    std::vector<DonneesAscii*> donnees_ascii_affichage;
    std::vector<LutBound*> lut;
    std::vector<int> numBorne;
    std::vector<LutColor*> couleurPoint;
    int typeinterp;
    eLutColorSpace systemeCouleur_OGL;
    int AttributLut;
    int liste;
    void MinMaxX();
    void MinMaxY();
    void MinMaxZ();
    void MinMaxI();
    void MinMaxCl();
    void Barycentre();
    void IntervalleAffichage();
    void AffectationIdBorne();
    void AffectationCouleur();
    void CalculId( int attr);
    void FabriqueListe();
    bool TestTypeCalcul(int numBoucle,int test_Systcoul);
    LutColor* AppliqueInterpolation(int entier1,int entier2,int entier3,
                                    eLutColorSpace entier_SystCoul);
    double minX;
    double maxX;
    double minY;
    double maxY;
    double minZ;
    double maxZ;
    double minI;
    double maxI;
    double barX,barY,barZ;
    int minCl,maxCl;
    wxString loadasciifilename_OGL;
    float angle;
    float transz;
    bool rottest;

DECLARE_EVENT_TABLE()
};



#endif // GLCANVAS_H
